package com.qfedu.shop.vo;

import lombok.Data;

/**
 * @author Feri
 * @date 2021/12/31 11:02
 * @description:TODO
 */
@Data
public class R {
    private int code;
    private String msg;
    private Object data;
    //贫血模式 充血模式 DDD模型
    public static R createR(int code,String msg,Object data){
        R r=new R();
        r.setCode(code);
        r.setData(data);
        r.setMsg(msg);
        return r;
    }
    public static R ok(String msg,Object data){
       return createR(200,msg,data);
    }
    public static R ok(Object data){
        return createR(200,"OK",data);
    }
    public static R ok(){
        return createR(200,"OK",null);
    }
    public static R fail(String msg){
        return createR(400,msg,null);
    }
}
